package com.hst.capacity.infra.persistence.jpa.setting.station;

import com.hst.capacity.domain.model.entity.setting.railway.RailwayEntity;
import com.hst.capacity.domain.model.entity.setting.station.StationEntity;
import com.hst.capacity.domain.model.response.setting.BusStationVO;
import com.hst.capacity.domain.model.response.setting.RailStationVO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface BusStationRepository extends CrudRepository<StationEntity, String> {

    /**
     * 通过地区CODE查找运营火车站
     * @param code
     * @return
     */
    List<StationEntity> findByCityCode(String code);

    StationEntity findByIdStation(String idStation);

    /**
     * 通过地区CODE查找汽车站
     * @param cityCode
     * @return
     */
    @Query("SELECT new com.hst.capacity.domain.model.response.setting.BusStationVO(t) FROM StationEntity t WHERE t.cityCode=:cityCode")
    List<BusStationVO> findByCode(String cityCode);

}
